package com.tencent.wxcloudrun.mapper;

import com.tencent.wxcloudrun.dto.Users;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Entity com.tencent.wxcloudrun.dto.Users
 */
@Mapper
public interface UsersMapper {

    Users selectByOpenid(String openid);

    int insert(Users users);

    /**
     * 修改用户昵称
     *
     * @param openid
     * @param nick
     * @return
     */
    @Update("update users set nick = #{nick} where openid = #{openid} ")
    int updateNickByOpenid(String openid, String nick);
    @Update("update users set avatarUrl = #{avatarUrl} where openid = #{openid} ")
    int updateavAtarUrlByOpenid(String openid, String avatarUrl);
    /**
     * 余额支付
     *
     * @param openid
     * @param newblance
     * @return
     */
    @Update("update users set balance = #{newblance} where openid = #{openid} ")
    int updateUserBalance(String openid, Integer newblance);

    /**
     * 手机号登陆
     * @param mobile
     * @return
     */
    @Select("select * from users where mobile = #{mobile} ")
    Users selectByMobile(String mobile);
}




